package org.gap.service;

import java.util.Calendar;
import java.util.List;
import java.util.Set;

import org.gap.domain.Adresses;
import org.gap.domain.AdressesTiers;
import org.gap.domain.Tiers;
import org.gap.domain.TiersModif;
import org.gap.domain.TiersRib;
import org.gap.domain.Utilisateurs;
import org.gap.domain.UtilisateursGroupe;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/GAP_v2-security-context.xml",
		"file:./resources/GAP_v2-service-context.xml",
		"file:./resources/GAP_v2-dao-context.xml",
		"file:./resources/GAP_v2-web-context.xml" })
@Transactional
public class UtilisateursServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected UtilisateursService service;

	/**
	 * Instantiates a new UtilisateursServiceTest.
	 *
	 */
	public UtilisateursServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	 * Save an existing TiersModif entity
	 * 
	 */
	@Test
	public void saveUtilisateursTiersModifs() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateursTiersModifs 
		String usrUser = null;
		TiersModif related_tiersmodifs = new org.gap.domain.TiersModif();
		Utilisateurs response = null;
		response = service.saveUtilisateursTiersModifs(usrUser, related_tiersmodifs);
		// TODO: JUnit - Add assertions to test outputs of operation: saveUtilisateursTiersModifs
	}

	/**
	 * Operation Unit Test
	 * Save an existing UtilisateursGroupe entity
	 * 
	 */
	@Test
	public void saveUtilisateursUtilisateursGroupes() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateursUtilisateursGroupes 
		String usrUser_1 = null;
		UtilisateursGroupe related_utilisateursgroupes = new org.gap.domain.UtilisateursGroupe();
		Utilisateurs response = null;
		response = service.saveUtilisateursUtilisateursGroupes(usrUser_1, related_utilisateursgroupes);
		// TODO: JUnit - Add assertions to test outputs of operation: saveUtilisateursUtilisateursGroupes
	}

	/**
	 * Operation Unit Test
	 * Load an existing Utilisateurs entity
	 * 
	 */
	@Test
	public void loadUtilisateurss() {
		Set<Utilisateurs> response = null;
		response = service.loadUtilisateurss();
		// TODO: JUnit - Add assertions to test outputs of operation: loadUtilisateurss
	}

	/**
	 * Operation Unit Test
	 * Delete an existing TiersModif entity
	 * 
	 */
	@Test
	public void deleteUtilisateursTiersModifs() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateursTiersModifs 
		String utilisateurs_usrUser = null;
		Integer related_tiersmodifs_tmoTiers = 0;
		String related_tiersmodifs_tmoNomChampModif = null;
		Calendar related_tiersmodifs_tmoDateModification = null;
		Utilisateurs response = null;
		response = service.deleteUtilisateursTiersModifs(utilisateurs_usrUser, related_tiersmodifs_tmoTiers, related_tiersmodifs_tmoNomChampModif, related_tiersmodifs_tmoDateModification);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteUtilisateursTiersModifs
	}

	/**
	 * Operation Unit Test
	 * Return all Utilisateurs entity
	 * 
	 */
	@Test
	public void findAllUtilisateurss() {
		// TODO: JUnit - Populate test inputs for operation: findAllUtilisateurss 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<Utilisateurs> response = null;
		response = service.findAllUtilisateurss(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllUtilisateurss
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findUtilisateursByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findUtilisateursByPrimaryKey 
		String usrUser_2 = null;
		Utilisateurs response = null;
		response = service.findUtilisateursByPrimaryKey(usrUser_2);
		// TODO: JUnit - Add assertions to test outputs of operation: findUtilisateursByPrimaryKey
	}

	/**
	 * Operation Unit Test
	 * Delete an existing TiersRib entity
	 * 
	 */
	@Test
	public void deleteUtilisateursTiersRibsForTrbUserCreation() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateursTiersRibsForTrbUserCreation 
		String utilisateurs_usrUser_1 = null;
		Integer related_tiersribsfortrbusercreation_trbTiers = 0;
		Integer related_tiersribsfortrbusercreation_trbRib = 0;
		Utilisateurs response = null;
		response = service.deleteUtilisateursTiersRibsForTrbUserCreation(utilisateurs_usrUser_1, related_tiersribsfortrbusercreation_trbTiers, related_tiersribsfortrbusercreation_trbRib);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteUtilisateursTiersRibsForTrbUserCreation
	}

	/**
	 * Operation Unit Test
	 * Delete an existing AdressesTiers entity
	 * 
	 */
	@Test
	public void deleteUtilisateursAdressesTiersesForAdtUserModification() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateursAdressesTiersesForAdtUserModification 
		String utilisateurs_usrUser_2 = null;
		Integer related_adressestiersesforadtusermodification_adtAdresse = 0;
		Integer related_adressestiersesforadtusermodification_adtTiers = 0;
		String related_adressestiersesforadtusermodification_adtTypeAdresse = null;
		String related_adressestiersesforadtusermodification_adtEtatAffectation = null;
		Calendar related_adressestiersesforadtusermodification_adtFinAffectation = null;
		Utilisateurs response = null;
		response = service.deleteUtilisateursAdressesTiersesForAdtUserModification(utilisateurs_usrUser_2, related_adressestiersesforadtusermodification_adtAdresse, related_adressestiersesforadtusermodification_adtTiers, related_adressestiersesforadtusermodification_adtTypeAdresse, related_adressestiersesforadtusermodification_adtEtatAffectation, related_adressestiersesforadtusermodification_adtFinAffectation);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteUtilisateursAdressesTiersesForAdtUserModification
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Tiers entity
	 * 
	 */
	@Test
	public void deleteUtilisateursTiers() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateursTiers 
		String utilisateurs_usrUser_3 = null;
		Integer related_tiers_tieTiers = 0;
		Utilisateurs response = null;
		response = service.deleteUtilisateursTiers(utilisateurs_usrUser_3, related_tiers_tieTiers);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteUtilisateursTiers
	}

	/**
	 * Operation Unit Test
	 * Delete an existing AdressesTiers entity
	 * 
	 */
	@Test
	public void deleteUtilisateursAdressesTiersesForAdtUserCreation() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateursAdressesTiersesForAdtUserCreation 
		String utilisateurs_usrUser_4 = null;
		Integer related_adressestiersesforadtusercreation_adtAdresse = 0;
		Integer related_adressestiersesforadtusercreation_adtTiers = 0;
		String related_adressestiersesforadtusercreation_adtTypeAdresse = null;
		String related_adressestiersesforadtusercreation_adtEtatAffectation = null;
		Calendar related_adressestiersesforadtusercreation_adtFinAffectation = null;
		Utilisateurs response = null;
		response = service.deleteUtilisateursAdressesTiersesForAdtUserCreation(utilisateurs_usrUser_4, related_adressestiersesforadtusercreation_adtAdresse, related_adressestiersesforadtusercreation_adtTiers, related_adressestiersesforadtusercreation_adtTypeAdresse, related_adressestiersesforadtusercreation_adtEtatAffectation, related_adressestiersesforadtusercreation_adtFinAffectation);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteUtilisateursAdressesTiersesForAdtUserCreation
	}

	/**
	 * Operation Unit Test
	 * Save an existing Utilisateurs entity
	 * 
	 */
	@Test
	public void saveUtilisateurs() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateurs 
		Utilisateurs utilisateurs = new org.gap.domain.Utilisateurs();
		service.saveUtilisateurs(utilisateurs);
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Adresses entity
	 * 
	 */
	@Test
	public void deleteUtilisateursAdressesesForAddUserModification() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateursAdressesesForAddUserModification 
		String utilisateurs_usrUser_5 = null;
		Integer related_adressesesforaddusermodification_addAdresse = 0;
		Utilisateurs response = null;
		response = service.deleteUtilisateursAdressesesForAddUserModification(utilisateurs_usrUser_5, related_adressesesforaddusermodification_addAdresse);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteUtilisateursAdressesesForAddUserModification
	}

	/**
	 * Operation Unit Test
	 * Save an existing Tiers entity
	 * 
	 */
	@Test
	public void saveUtilisateursTiers() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateursTiers 
		String usrUser_3 = null;
		Tiers related_tiers = new org.gap.domain.Tiers();
		Utilisateurs response = null;
		response = service.saveUtilisateursTiers(usrUser_3, related_tiers);
		// TODO: JUnit - Add assertions to test outputs of operation: saveUtilisateursTiers
	}

	/**
	 * Operation Unit Test
	 * Save an existing AdressesTiers entity
	 * 
	 */
	@Test
	public void saveUtilisateursAdressesTiersesForAdtUserCreation() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateursAdressesTiersesForAdtUserCreation 
		String usrUser_4 = null;
		AdressesTiers related_adressestiersesforadtusercreation = new org.gap.domain.AdressesTiers();
		Utilisateurs response = null;
		response = service.saveUtilisateursAdressesTiersesForAdtUserCreation(usrUser_4, related_adressestiersesforadtusercreation);
		// TODO: JUnit - Add assertions to test outputs of operation: saveUtilisateursAdressesTiersesForAdtUserCreation
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Utilisateurs entity
	 * 
	 */
	@Test
	public void deleteUtilisateurs() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateurs 
		Utilisateurs utilisateurs_1 = new org.gap.domain.Utilisateurs();
		service.deleteUtilisateurs(utilisateurs_1);
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Adresses entity
	 * 
	 */
	@Test
	public void deleteUtilisateursAdressesesForAddUserCreation() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateursAdressesesForAddUserCreation 
		String utilisateurs_usrUser_6 = null;
		Integer related_adressesesforaddusercreation_addAdresse = 0;
		Utilisateurs response = null;
		response = service.deleteUtilisateursAdressesesForAddUserCreation(utilisateurs_usrUser_6, related_adressesesforaddusercreation_addAdresse);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteUtilisateursAdressesesForAddUserCreation
	}

	/**
	 * Operation Unit Test
	 * Save an existing TiersRib entity
	 * 
	 */
	@Test
	public void saveUtilisateursTiersRibsForTrbUserCreation() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateursTiersRibsForTrbUserCreation 
		String usrUser_5 = null;
		TiersRib related_tiersribsfortrbusercreation = new org.gap.domain.TiersRib();
		Utilisateurs response = null;
		response = service.saveUtilisateursTiersRibsForTrbUserCreation(usrUser_5, related_tiersribsfortrbusercreation);
		// TODO: JUnit - Add assertions to test outputs of operation: saveUtilisateursTiersRibsForTrbUserCreation
	}

	/**
	 * Operation Unit Test
	 * Save an existing Adresses entity
	 * 
	 */
	@Test
	public void saveUtilisateursAdressesesForAddUserCreation() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateursAdressesesForAddUserCreation 
		String usrUser_6 = null;
		Adresses related_adressesesforaddusercreation = new org.gap.domain.Adresses();
		Utilisateurs response = null;
		response = service.saveUtilisateursAdressesesForAddUserCreation(usrUser_6, related_adressesesforaddusercreation);
		// TODO: JUnit - Add assertions to test outputs of operation: saveUtilisateursAdressesesForAddUserCreation
	}

	/**
	 * Operation Unit Test
	 * Delete an existing TiersRib entity
	 * 
	 */
	@Test
	public void deleteUtilisateursTiersRibsForTrbUserModification() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateursTiersRibsForTrbUserModification 
		String utilisateurs_usrUser_7 = null;
		Integer related_tiersribsfortrbusermodification_trbTiers = 0;
		Integer related_tiersribsfortrbusermodification_trbRib = 0;
		Utilisateurs response = null;
		response = service.deleteUtilisateursTiersRibsForTrbUserModification(utilisateurs_usrUser_7, related_tiersribsfortrbusermodification_trbTiers, related_tiersribsfortrbusermodification_trbRib);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteUtilisateursTiersRibsForTrbUserModification
	}

	/**
	 * Operation Unit Test
	 * Save an existing Adresses entity
	 * 
	 */
	@Test
	public void saveUtilisateursAdressesesForAddUserModification() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateursAdressesesForAddUserModification 
		String usrUser_7 = null;
		Adresses related_adressesesforaddusermodification = new org.gap.domain.Adresses();
		Utilisateurs response = null;
		response = service.saveUtilisateursAdressesesForAddUserModification(usrUser_7, related_adressesesforaddusermodification);
		// TODO: JUnit - Add assertions to test outputs of operation: saveUtilisateursAdressesesForAddUserModification
	}

	/**
	 * Operation Unit Test
	 * Save an existing TiersRib entity
	 * 
	 */
	@Test
	public void saveUtilisateursTiersRibsForTrbUserModification() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateursTiersRibsForTrbUserModification 
		String usrUser_8 = null;
		TiersRib related_tiersribsfortrbusermodification = new org.gap.domain.TiersRib();
		Utilisateurs response = null;
		response = service.saveUtilisateursTiersRibsForTrbUserModification(usrUser_8, related_tiersribsfortrbusermodification);
		// TODO: JUnit - Add assertions to test outputs of operation: saveUtilisateursTiersRibsForTrbUserModification
	}

	/**
	 * Operation Unit Test
	 * Return a count of all Utilisateurs entity
	 * 
	 */
	@Test
	public void countUtilisateurss() {
		Integer response = null;
		response = service.countUtilisateurss();
		// TODO: JUnit - Add assertions to test outputs of operation: countUtilisateurss
	}

	/**
	 * Operation Unit Test
	 * Delete an existing UtilisateursGroupe entity
	 * 
	 */
	@Test
	public void deleteUtilisateursUtilisateursGroupes() {
		// TODO: JUnit - Populate test inputs for operation: deleteUtilisateursUtilisateursGroupes 
		String utilisateurs_usrUser_8 = null;
		String related_utilisateursgroupes_ugrGroupe = null;
		String related_utilisateursgroupes_ugrUser = null;
		Utilisateurs response = null;
		response = service.deleteUtilisateursUtilisateursGroupes(utilisateurs_usrUser_8, related_utilisateursgroupes_ugrGroupe, related_utilisateursgroupes_ugrUser);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteUtilisateursUtilisateursGroupes
	}

	/**
	 * Operation Unit Test
	 * Save an existing AdressesTiers entity
	 * 
	 */
	@Test
	public void saveUtilisateursAdressesTiersesForAdtUserModification() {
		// TODO: JUnit - Populate test inputs for operation: saveUtilisateursAdressesTiersesForAdtUserModification 
		String usrUser_9 = null;
		AdressesTiers related_adressestiersesforadtusermodification = new org.gap.domain.AdressesTiers();
		Utilisateurs response = null;
		response = service.saveUtilisateursAdressesTiersesForAdtUserModification(usrUser_9, related_adressestiersesforadtusermodification);
		// TODO: JUnit - Add assertions to test outputs of operation: saveUtilisateursAdressesTiersesForAdtUserModification
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
